package com.zjut.zs.coname.manager;

import java.util.List;

import javax.annotation.Resource;

import com.zjut.an.util.module.PageModule;
import com.zjut.an.util.system.Status;
import com.zjut.zs.coname.dao.ZsCoName;
import com.zjut.zs.coname.dao.ZsCoNameDAO;
import com.zjut.zs.userinfo.dao.ZsUserinfo;
import com.zjut.zs.userinfo.dao.ZsUserinfoDAO;


public class ZsCoNameManager {

	@Resource(name = "ZsCoNameDAO")
	private ZsCoNameDAO dao;
	
	public void addData(ZsCoName obj) {	
		dao.save(obj);
	}
	
	public void updateData(ZsCoName obj) {
		dao.update(obj);
	}
	
	public void deleteData(ZsCoName obj) {
		dao.delete(obj);
	}

	public void deleteDatas(List<ZsCoName> objlist) {
		for (ZsCoName ZsCoName : objlist) {
			dao.delete(ZsCoName);
		}
	}
	
	public PageModule getDataByInstance (int pageNumber,int pageSize, String sort, String order, ZsCoName obj) {
		return dao.findByInstance(pageNumber, pageSize, sort, order, obj);
	}

	public List getDatasForExcel() {
		//返回一个用于excel导出的字段列表，用户在此基础上再选择
		return dao.findByExcelPermit(Status.YES.getStatus());
	}

	public List getDatasForUp() {
		//返回一个用于excel导出的字段列表，用户在此基础上再选择
		return dao.findByUpPermit(Status.YES.getStatus());
	}
	
	public List getDatas() {
		return dao.findAll();
	}

	public ZsCoName getData(int objId) {
		return dao.findById(objId);
	}

	public ZsCoName getDataByCoEn(String coEn) {
		ZsCoName coname = new ZsCoName();
		List list = dao.findByCoEn(coEn);
		if (list.size()>0) {
			coname = (ZsCoName)list.get(0);
		}
		return coname;
	}
}
